Introduce RemoteCollection.Remove()#731
Conversation
LibGit2Sharp/Core/Proxy.cs
Outdated
There was a problem hiding this comment.
Noticed that git_branch_delete has SetHandleAsInvalid before ZeroResult.
Does the order matter for code consistency?
There was a problem hiding this comment.
Given the git_remote_delete() implementation, I think your code construct is better.
if res < 0, we'll throw and the handle will be freed by the surrounding using statement.
I think git_branch_delete() should be fixed and follow the same pattern if the call to free() is the last line in libgit2 code.
|
I guess it should be fine now. |
LibGit2Sharp/Core/Proxy.cs
Outdated
There was a problem hiding this comment.
How about something like this?
RemoteSafeHandle remote = null;
try
{
remote = Proxy.git_remote_load(repo, name, false);
if (remote == null)
{
return;
}
int res = NativeMethods.git_remote_delete(remote);
Ensure.ZeroResult(res);
remote.SetHandleAsInvalid();
}
finally
{
handle.SafeDispose();
}There was a problem hiding this comment.
oh, didn't find SafeDispose before. :O
|
Also, on a side note: I'm on a Mono machine atm, and since the build fails with my current Mono, I'd rather see travis tell me if it builds or not. I'm dry-coding atm. |
|
Woot, I need to find a way to get the refs, and not being able to build is a pain since I can't debug. Either this, or wait 2 hours so I get home. |
repo exposes a |
|
The test fails because the |
Yeah for integration testing! |
|
Permission to bump native libs? |
|
👍 |
LibGit2Sharp.Tests/RemoteFixture.cs
Outdated
There was a problem hiding this comment.
Thinking about it, how would you feel about going on step further and check all the refs from this remote?
Assert.NotEmpty(repo.Refs.FromGlob("refs/remotes/origin/*"));
repo.Network.Remotes.Remove("origin");
Assert.Null(repo.Network.Remotes["origin"]);
Assert.Empty(repo.Refs.FromGlob("refs/remotes/origin/*"));
|
Done, waiting on build. |
|
🎱 |
closes #729